import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '../views/layout/index.vue'

Vue.use(VueRouter)


const routes = [

  {
    path: '/',
    redirect: '/home/dashboard'
  },
  {
    path: '/home',
    name: 'home',
    meta: { title: '首页', icon: 'icon-panel' },
    component: layout,
    children: [
      {
        path: 'dashboard',
        name: 'dashboard',
        meta: { title: '仪表盘' },
        component: () => import(/* webpackChunkName: "dashboard" */ '../views/dashboard/index.vue')
      },
      {
        path: 'data',
        name: 'data',
        meta: { title: '设备数据' },
        component: () => import(/* webpackChunkName: "data" */ '../views/dashboard/data.vue')
      }
    ]
  },
  {
    path: '/device',
    name: 'device',
    meta: { title: '设备', icon: 'icon-panel' },
    component: layout,
    children: [
      {
        path: 'gateway',
        name: 'gateway',
        meta: { title: '网关' },
        component: () => import(/* webpackChunkName: "gateway" */ '../views/device/gateway.vue')
      },
      {
        path: 'servegroup',
        name: 'servegroup',
        meta: { title: '群组' },
        component: () => import(/* webpackChunkName: "servegroup" */ '../views/device/servegroup.vue')
      },
      {
        path: 'cgqlist',
        name: 'cgqlist',
        component: () => import(/* webpackChunkName: "cgqlist" */ '../views/device/cgqlist.vue')
      },
    ]
  },
  {
    path: '/spend',
    name: 'spend',
    meta: { title: '计费', icon: 'icon-panel' },
    component: layout,
    children: [
      {
        path: 'accountmsg',
        name: 'accountmsg',
        meta: { title: '账户信息' },
        component: () => import(/* webpackChunkName: "accountmsg" */ '../views/spend/accountmsg.vue')
      },
      {
        path: 'used',
        name: 'used',
        component: () => import(/* webpackChunkName: "used" */ '../views/spend/used.vue')
      },
      {
        path: 'spent',
        name: 'spent',
        component: () => import(/* webpackChunkName: "spent" */ '../views/spend/spent.vue')
      },


    ]
  },
  {
    path: '/account',
    name: 'account',
    // meta: { title: '测量类型', icon: 'icon-panel' },
    component: layout,
    children: [
      {
        path: 'accountlist',
        name: 'accountlist',
        // meta: { title: '测量类型列表' },
        component: () => import(/* webpackChunkName: "accountlist" */ '../views/account/accountlist.vue')
      },
      {
        path: 'addaccount',
        name: 'addaccount',
        // meta: { title: '添加测量类型' },
        component: () => import(/* webpackChunkName: "addaccount" */ '../views/account/addaccount.vue')
      },
    ]
  },
  {
    path: '/safe',
    name: 'safe',
    component: layout,
    children: [
      {
        path: 'addsafe',
        name: 'addsafe',
        component: () => import(/* webpackChunkName: "addsafe" */ '../views/safe/addsafe.vue')
      },
      {
        path: 'safelist',
        name: 'safelist',
        component: () => import(/* webpackChunkName: "safelist" */ '../views/safe/safelist.vue')
      },
    ]
  },
  {
    path: '/test',
    name: 'test',
    component: layout,
    children: [
      {
        path: 'testlist',
        name: 'testlist',
        component: () => import(/* webpackChunkName: "testlist" */ '../views/test/testlist.vue')
      },
      {
        path: 'testtype',
        name: 'testtype',
        component: () => import(/* webpackChunkName: "testtype" */ '../views/test/testtype.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/login/index.vue')
  },
  {
    path: '*',
    name: 'page404',
    component: () => import(/* webpackChunkName: "page404" */ '../views/page404/index.vue')
  },
]

const router = new VueRouter({
  routes
})

export default router
